<!doctype html>
<html>
<head>
   		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	    <meta name="format-detection" content="telephone=no">
	    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
	    <link href="../../../css/bootstrap.css" rel="stylesheet" />
	    <link href="../../../css/cover.css" rel="stylesheet" />
	    <link href="../../../css/font-awesome.min.css" rel="stylesheet" />
	    <title>荆州千网汇信息科技有限公司</title>
	    <script src="../../../js/jquery-2.2.3.min.js"></script>
	    <script src="../../../js/jquery.flexslider-min.js"></script>
	    <script src="../../../js/rem.js"></script>
	    <script src="../../../js/itnetcao.js"></script>
	    <link href="../../../js/layui/css/layui.css" rel="stylesheet" />
	    <link href="../../../js/donghua/animsition.min.css" rel="stylesheet" />
	    <script src="../../../js/donghua/animsition.min.js"></script>
	    <link rel="stylesheet" href="../../../css/minirefresh.css" />
	    <link rel="stylesheet" href="../../../css/common.css" />
	    <script type="text/javascript" src="../../../js/minirefresh.js"></script>
	    <script type="text/javascript" src="../../../js/common.js"></script>
		<title>exchange</title>



		<style type='text/css'>
		body{
			margin:0px;
			padding:0px;
		}
		</style>





</head>
<body>


	<div class="page_top01 relative">
        <h3 class="text-center">修改密码</h3>
        <a href="javascript:;" class="animsition-link" data-animsition-out-class="fade-out-right" data-animsition-out-duration="500" onclick="history.go(-1)">
            <img src="../../../images/icon_left.png" class="img-responsive reture_img" /></a>
    </div>

	<div class="layui-fluid layui-form layui-form-pane" style='margin-top:10%;'>

		<div class="layui-row layui-col-space15">
			<div class="layui-col-xs12">
				<input type="text" name="proKey" placeholder="请输入手机号码" class="layui-input iphone">
			</div>
		</div>

		<div class="layui-row layui-col-space15">
			<div class="layui-col-xs12">
				<input type="password" name="proKey" placeholder="请输入新密码" class="layui-input passwords">
			</div>
		</div>

		<div class="layui-row layui-col-space15">
			<div class="layui-col-xs12">
				<input type="password" name="proKey" placeholder="请输入确认新密码" class="layui-input newPasswords">
			</div>
		</div>

		<div class="layui-row layui-col-space15">
			<div class="layui-col-xs6">
				<input type="text" name="proKey" placeholder="请输入验证码" class="layui-input iphoneCode">
			</div>
			<div class="layui-col-xs6">
				<button class='getIphoneCode layui-btn layui-btn-normal' id="but_yzm">获取验证码</button>
			</div>
		</div>

		<div class="layui-row layui-col-space15" style='margin-top:20%;'>
			<button onclick="f1()" class='layui-btn layui-btn-warm' style='width:100%;'>修改</button>
		</div>

	</div>


    <script>
    		var a_count = 120;

			$(function() {
				$(".getIphoneCode").click(function() {
					if($(".getIphoneCode").text() != "获取验证码") {
						return;
					}
					if($(".iphone").val().trim().length == 0) {
	  					alert("请输入手机号码.");
	  					return;
	  				}
	  				if($(".iphone").val().trim().length != 11) {
	  					alert("请输入正确的手机号码.");
	  					return;
	  				}
	  				var n = setInterval(function() {
	  					a_count--;
	  					if(a_count <= 0) {
	  						$(".getIphoneCode").text("获取验证码")
	  						window.clearInterval(n);
	  						return;
	  					}
	  					$(".getIphoneCode").text(a_count + "重新获取.")
	  				}, 1000)
					var url = localStorage.getItem("url") + "/user/controller/getUserIPhoneCodeAPP.do";
	  				var data = "iphone=" + $(".iphone").val();
	  				itcao.itGetAjaxBigData(url, data).done(function(result) {
	  					var json = jQuery.parseJSON(result);
	  					if(json.state == true) {
	  						alert("验证码获取成功.");
	  						localStorage.setItem("user_iphone_code", json.bean);
	  					}else {
	  						alert("验证码获取失败.");
	  					}
	  				})
				})
			})

  			function f1(){
  				if($(".iphone").val().trim().length == 0) {
  					alert("请输入手机号码.");
  					return;
  				}
  				if($(".iphone").val().trim().length != 11) {
  					alert("请输入正确的手机号码.");
  					return;
  				}
  				if($(".passwords").val().trim().length == 0) {
  					alert("请输入新的密码.");
  					return;
  				}
  				if($(".passwords").val().trim() != $(".newPasswords").val().trim()) {
  					alert("两次输入的密码不一致.");
  					return;
  				}
  				if($(".iphoneCode").val().trim().length == 0) {
  					alert("请输入手机验证码.");
  					return;
  				}
  				if(localStorage.getItem("user_iphone_code") != $(".iphoneCode").val().trim()) {
  					alert("验证码输入错误,请重新输入.");
  					return;
  				}
  				var url = localStorage.getItem("url") + "/user/controller/UpdateUserLoginPassword.do";
  				var data = "userIphone=" + $(".iphone").val().trim() + "&userPassword=" + $(".passwords").val().trim() + "&newLoginPas=" + $(".newPasswords").val().trim();
  				itcao.itGetAjaxBigData(url, data).done(function(result) {
  					var json = jQuery.parseJSON(result);
  					if(json.state == true) {
  						alert("修改成功.");
  						setTimeout(function() {
  							window.location.href = "../login/login.html";
  						}, 500)
  					}else {
  						alert(json.value);
  					}
  				})
  			};
  		</script>
</body>
</html>
